package org.elanfox.intellicommunity.common.ienum.base;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/1/6
 */
public class SingleArgEnumHelper {
    public static <T extends SingleArgCommonEnum> T getEnumTypeByValue(Class<T> tClass, Object value) {
        if (value == null) {
            return null;
        }
        for (T enumConstant : tClass.getEnumConstants()) {
            if (enumConstant.getValue().equals(value)) {
                return enumConstant;
            }
        }
        return null;
    }
}
